﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProjectEuler
{
    class Problem7
    {
        // What is the 10 001st prime number?
        public int Solve()
        {
            var primeNum = 0;
            var n = 1;

            while (primeNum != 10001)
            {
                n++;

                if (IsPrime(n))
                    primeNum++;
            }

            return n;
        }

        public bool IsPrime(int number)
        {
            if (number <= 2) return true;
            for (int i = 2; i * i <= number; i++)
            {
                if (number % i == 0) return false;
            }
            return true;
        }

    }
}
